package com.xiaoquan.myspring.SpringIOC.step2.factory.support;

import com.xiaoquan.myspring.SpringIOC.step2.factory.config.SingletonBeanRegistry;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: 周海权
 * @CreateTime: 2024-08-30
 * @Description:
 * @Version: 1.0
 */
public class DefaultSingletonBeanRegistry implements SingletonBeanRegistry {
    private Map<String,Object> singletonMap=new HashMap<String,Object>();

    @Override
    public Object getSingleton(String beanName) {
        return singletonMap.get(beanName);
    }

    public void addSingleton(String beanName, Object singleton) {
        singletonMap.put(beanName, singleton);
    }
}

